#!/bin/bash

echo "makefile..."
make compile

# Test whether input parameter is empty.
if [ ! -n "$1" ];
then
    NUM=10
else
    NUM=$1  
fi

if [ $NUM -lt 1 ];
then
    echo "INPUT ERROR!"
    exit 0
fi

# Test the program
echo "test, generate result and redirect..."
./generator $NUM
./test > result.txt

# clean
rm ./generator

echo "FINISH!"

exit 0
